//
//  LXMainNavViewController.m
//  cat
//
//  Created by imera on 16/1/8.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "LXMainNavViewController.h"

@interface LXMainNavViewController ()

/*** 导航栏底部的横线 */
@property (nonatomic, strong) UIImageView *navBarLineImageView;

@end 

@implementation LXMainNavViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UINavigationBar *bar = self.navigationBar;
    
    [bar setBarTintColor:[UIColor redColor]];

    self.navigationBarHidden = YES;
    /*** 隐藏导航栏底部的横线 */
    self.navBarLineImageView = [self findUnderLine:bar];
}

- (UIImageView *)findUnderLine:(UIView *)view
{
    if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
        return (UIImageView *)view;
    }
    for (UIView *subview in view.subviews) {
        UIImageView *imageView = [self findUnderLine:subview];
        if (imageView) {
            return imageView;
        }
    }
    return nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navBarLineImageView.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navBarLineImageView.hidden = NO;
}
@end
